package org.lanqiao.tjut.control;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lanqiao.tjut.bean.ScoreBean;
import org.lanqiao.tjut.bean.StudentBean;
import org.lanqiao.tjut.myUtils.MyUtils;
import org.lanqiao.tjut.service.ServiceFactory;

public class QueryStuSelfClass2 extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		// 在这添加查询学生选课结果并放入缓存
		ScoreBean scorebean = (ScoreBean) MyUtils.getNewInsdence(ScoreBean.class);
		StudentBean stuBean = (StudentBean) request.getSession().getAttribute("LoginedUserS");
		scorebean.setStuname(stuBean.getStuname());
		List<ScoreBean> lst1 = ServiceFactory.getSelectClassManagerServiceInstance().getStuAllClassInfo(scorebean);
		// 将需要显示的结果(查询的学生所有选课信息)存入session缓存中
		request.getSession().setAttribute("lst1", lst1);

		// 跳转到相应页面进行显示
		request.getRequestDispatcher("SelectClass/ClassDetailsS.jsp").forward(request, response);
	}

	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		super.destroy();
	}

	@Override
	public void init() throws ServletException {
		// TODO Auto-generated method stub
		super.init();
	}

}
